
#include "ItemUse.h"
#include "Common/TableData/ItemItemCfg.h"
#include "Common/CharacterDefine.h"
#include "Character/Part.h"
#include "Common/TableDataEx/ItemCfg.h"
#include "Character/drop/DropMgr.h"
#include "Character/npc/Npc.h"
#include "Character/monster/Monster.h"
#include "Character/Player.h"
#include "Duplicate/DuplicateMgr.h"
#include "Character/SkillPart.h"
#include "Character/PvpPart.h"
#include "Character/horse/HorsePart.h"
#include "Character/PlayerMgr.h"

CItemUse::CItemUse()
{

}

CItemUse::~CItemUse()
{

}

int32_t CItemUse::useItem(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, Creature *pCreatrue, UseItemArgProto &arg)
{
	if (nullptr == pItemCfg || nullptr == pCreatrue || nNum <= 0)
	{
		return RET_FAIL;
	}
	//参数
	Creature *pTargetCreature = nullptr;
	const VEC_INT32 *pVecFuncParam = g_GetItemCfgMgr()->GetItemFuncParamCfg((uint32_t)pItemCfg->id);
	const VEC_INT32 *pVecOtherParam = g_GetItemCfgMgr()->GetItemOtherParamCfg((uint32_t)pItemCfg->id);
	if (nullptr == pVecFuncParam || nullptr == pVecOtherParam)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}

	//是否可使用
	if (!pItemCfg->isCanUse)
	{
		return RET_PACKAGE_ITEM_CAN_NOT_USE;
	}
	if (nNum > 1)
	{
		//是否批量使用
		if (!pItemCfg->isCanBatchUse)
		{
			return RET_PACKAGE_ITEM_CAN_NOT_BATCH_USE;
		}
	}
	//等级
	if (pItemCfg->levelRequest > 0)
	{
		if ((int32_t)pCreatrue->GetAttr(C_LEVEL) < pItemCfg->levelRequest)
		{
			return RET_LEVEL_LACK;
		}
	}
	//种族
	if (pItemCfg->raceRequest > 0)
	{
		if ((int32_t)pCreatrue->GetAttr(C_RACE) != pItemCfg->raceRequest)
		{
			return RET_RACE_ERROR;
		}
	}
	//职业
	if (pItemCfg->careerRequest > 0)
	{
		if ((int32_t)pCreatrue->GetAttr(C_PROF) != pItemCfg->careerRequest)
		{
			return RET_PROF_ERROR;
		}
	}
	//性别
	if (pItemCfg->sexRequest > 0)
	{
		if ((int32_t)pCreatrue->GetAttr(C_GENDER) != pItemCfg->sexRequest)
		{
			return RET_SEX_ERROR;
		}
	}
	//场景，区域，目标判断
	
	int32_t isize = pVecOtherParam->size();
	if (isize > 0)
	{
		int32_t itype = pVecOtherParam->at(0);
		if ((int32_t)EItemOtherParamType::EItemOtherParamType_Scene == itype)
		{
			if (isize < 2)
			{
				return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
			}
			uint32_t mapId = (uint32_t)pVecOtherParam->at(1);
			if (mapId != pCreatrue->GetMapId())
			{
				return RET_SCENE_NOT_IN_DEST_MAP;
			}
		}
		else if ((int32_t)EItemOtherParamType::EItemOtherParamType_Area == itype)
		{
			if (isize < 2)
			{
				return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
			}
			if (!arg.has_cur_pos())
			{
				return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
			}
			Scene *pScene = pCreatrue->GetScene();
			if (nullptr == pScene)
			{
				return RET_FAIL;
			}
			uint32_t areaId = pVecOtherParam->at(1);
			const Vector3PB &protoPos = arg.cur_pos();
			Point3<float> pos(protoPos.x(), protoPos.y(), protoPos.z());
			if (!pScene->InArea(areaId, pos))
			{
				return RET_SCENE_NOT_IN_AREA;
			}
		}
		else if ((int32_t)EItemOtherParamType::EItemOtherParamType_Target == itype)
		{
			if (isize < 3)
			{
				return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
			}
			if (!arg.has_target_cid())
			{
				return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
			}
			Scene *pScene = pCreatrue->GetScene();
			if (nullptr == pScene)
			{
				return RET_FAIL;
			}
			CharIDType targetCid = arg.target_cid();
			pTargetCreature = pScene->GetCreature(targetCid);
			if (nullptr == pTargetCreature)
			{
				return RET_PACKAGE_ITEM_TARGET_ERROR;
			}
			int32_t targetType = pVecOtherParam->at(1); //目标类型（1，NPC；2，怪物；3，场景物件）
			int32_t targetId = pVecOtherParam->at(2);
			if (1 == targetType)
			{
				Npc *pNpc = dynamic_cast<Npc*>(pTargetCreature);
				if (nullptr == pNpc)
				{
					return RET_PACKAGE_ITEM_TARGET_ERROR;
				}
				if ((uint32_t)targetId != pNpc->GetConfigId())
				{
					return RET_PACKAGE_ITEM_TARGET_ERROR;
				}
			}
			else if (2 == targetType)
			{
				Monster *pMonster = dynamic_cast<Monster*>(pTargetCreature);
				if (nullptr == pMonster)
				{
					return RET_PACKAGE_ITEM_TARGET_ERROR;
				}
				if ((uint32_t)targetId != pMonster->GetConfigId())
				{
					return RET_PACKAGE_ITEM_TARGET_ERROR;
				}
			}
			else  //为3的时候后面再定
			{
				return RET_PACKAGE_ITEM_TARGET_ERROR;

			}
		}
		else
		{
			return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
		}
	}
	

	return onUse(pItemCfg, item, nNum, pVecFuncParam, pCreatrue, pVecOtherParam, arg, pTargetCreature);
}

int32_t CItemUse::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pCreatrue);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);

	return RET_FAIL;
}

/////////////////////////////////  CItemUse_NoFunc /////////////////////////////////////////

int32_t CItemUse_NoFunc::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pCreatrue);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);

	return RET_SUCCESS;
}




//////////////////////////////  CItemUse_ModAttr ////////////////////////////////////////////

int32_t CItemUse_ModAttr::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	//functionType=1 属性ID，数值类型（1，固定值；2，百分比），数值
	if (pVecParam->size() < 3)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	Player *pPlayer = dynamic_cast<Player*>(pCreatrue);
	if (nullptr == pPlayer)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	
	int32_t attrId = pVecParam->at(0);
	int32_t itype = pVecParam->at(1);
	int32_t val = pVecParam->at(2);
	if (attrId > C_NONE && attrId < C_CHARACTER_PRO)
	{
		if (attrId == C_HP && pCreatrue->GetAttr(C_HP) >= pCreatrue->GetAttr(C_MAX_HP))
		{
			return RET_PACKAGE_HP_FULL;
		}
		if (attrId == C_MP && pCreatrue->GetAttr(C_MP) >= pCreatrue->GetAttr(C_MAX_MP))
		{
			return RET_PACKAGE_MP_FULL;
		}

		
		if (C_HP == attrId || C_MP == attrId) //回血回蓝的，需要判断地图是否可以使用
		{
			uint32_t mapId = pPlayer->GetMapId();
			const MapMapCfgInfo *pMapCfgInfo = g_GetMapMapCfgTable()->GetMapMapCfgInfo(mapId);
			if (nullptr != pMapCfgInfo && !pMapCfgInfo->canSupply)
			{
				return RET_PACKAGE_MAP_NOT_USE_ITEM;
			}
		}


		if (2 == itype) //百分比
		{
			int32_t curVal = pCreatrue->GetAttr(attrId);
			val = (int32_t)((curVal * val) / 100.0);
		}
		val *= nNum;
		if (C_EXP == attrId) //加经验单独接口
		{
			pPlayer->AddExp(val);
		}
		else if (C_UNION_CONTRI == attrId)	//加公会贡献
		{
			if (pPlayer->GetAttr(C_UNION_ID) <= 0)
				return RET_UNION_NOT_JOIN;
			LC_UnionUpdateAttrReq req;
			req.set_charid(pPlayer->GetCid());
			req.set_unioncontri(val);
			req.set_source(S_USE_ITEM);
			g_GetLogicService()->SendDataToCenter(EMODULE_ID_UNION, LOGIC_TO_CENTER_UNION_UPDATE_ATTR, &req);
		}
		else if (C_GOLD == attrId
			|| C_DIAMOND == attrId
			|| C_DIAMOND_BIND == attrId
			)
		{
			pPlayer->AddSourceAttr(attrId, val, true, S_ItemUse);
		}
		else if (C_CAMP_PRESTIGE == attrId) //声望
		{
			MAP_UINT64_INT32 mapAttr;
			mapAttr[pPlayer->GetCid()] = val;
			g_GetPlayerMgr()->L2C_AddPrestige(mapAttr);
		}
		else
		{
			pPlayer->AddAttr(attrId, val, true);
		}		
	}

	return RET_SUCCESS;
}

/////////////////////////////// CItemUse_Box ///////////////////////////////////////////
int32_t CItemUse_Box::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);

	//functionType = 9 关联宝箱表ID
	if (pVecParam->size() < 1)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	Part *pPart = pCreatrue->GetPart(PART_PACKAGE);
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}
	int32_t boxId = pVecParam->at(0);
	VEC_INT32 vecBox;
	vecBox.clear();
	for (int32_t i = 0; i < nNum; ++i)
	{
		vecBox.push_back(boxId);
	}	
	SItemSourceParam sourceParam;
	sourceParam.source = S_USE_ITEM;
	int32_t ret = g_GetDropMgr()->PlayerAddBox(dynamic_cast<Player*>(pCreatrue), vecBox, sourceParam);
	if (RET_SUCCESS != ret)
	{
		return ret;
	}

	return RET_SUCCESS;
}

//////////////////////////////////////////////////////////////////////////
int32_t CItemUse_RelateSkill::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);

	//functionType=11 关联技能ID，技能等级
	if (pVecParam->size() < 2)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	int32_t skillId = pVecParam->at(0);
	int32_t skillLev = pVecParam->at(1);
	SkillPart *pSkillPart = dynamic_cast<SkillPart*>(pCreatrue->GetPart(PART_SKILL));
	if (nullptr == pSkillPart)
	{
		return RET_FAIL;
	}
	if (pSkillPart->BeginUseSkillByItem(skillId, skillLev, pTarget))
	{
		return RET_SUCCESS;
	}

	return RET_FAIL;
}


////////////////////////////////// CItemUse_TriggerTask  ////////////////////////////////////////

int32_t CItemUse_TriggerTask::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	if (pVecParam->size() < 1)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	uint32_t chapterId = pVecParam->at(0);
	MissionPart *pPart = dynamic_cast<MissionPart*>(pCreatrue->GetPart(PART_MISSION));
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}

	//这里调用任务那边接取任务
	if (!pPart->AcceptMissionByUseItem(chapterId))
	{
		return RET_FAIL;
	}

	return RET_SUCCESS;
}


///////////////////////////////////  CItemUse_TaskUse ///////////////////////////////////////

int32_t CItemUse_TaskUse::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(pCreatrue);
	_UNUSE(arg);
	_UNUSE(pTarget);
	return RET_SUCCESS;
}

/////////////////////////////////   CItemUse_ExpandPackage  /////////////////////////////////////////

int32_t CItemUse_ExpandPackage::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	Part *pPart = pCreatrue->GetPart(PART_PACKAGE);
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}
	return pPart->Expand((uint16_t)nNum);
}

/////////////////////////////////   EItemFuncType_StarSoul  /////////////////////////////////////////

int32_t CItemUse_StarSoul::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	Part *pPart = pCreatrue->GetPart(PART_PACKAGE);
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}
	int16_t nIndex = item->GetIndex();
	return pPart->OnStarSoul(nIndex);
}

/////////////////////////////////   EItemFuncType_Fashion  /////////////////////////////////////////

int32_t CItemUse_Fashion::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	Part *pPart = pCreatrue->GetPart(PART_PACKAGE);
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}
	return pPart->ActiveFashion(pItemCfg->id, pVecParam->at(0));
}



int32_t CItemUse_ClearAnger::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	PvpPart *pPart = dynamic_cast<PvpPart*>(pCreatrue->GetPart(PART_PVP));
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}
	if (pVecParam->at(0) < 0 || nNum < 0)
	{
		return RET_PARMAR_ERROR;
	}
	if (pPart->GetPkKillingValue() <= 0)
	{
		return RET_PACKAGE_NO_ANGER;
	}
	pPart->SubPkKillingValue(pVecParam->at(0) * nNum);
	pPart->SendPvpKillingValue();
	return RET_SUCCESS;
}



int32_t CItemUse_HpMpBox::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	
	//functionType=25 关联属性（1，生命；2，魔法）；回复的总量；skill ID；每次技能回复的总百分比（放大万倍填写）
	if (pVecParam->size() < 4)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	int32_t leftHpMpVal = item->GetHpMpValue();
	if (leftHpMpVal <= 0)
	{
		return RET_PACKAGE_ITEM_CAN_NOT_USE;
	}
	int32_t itype = pVecParam->at(0);
	if (1 != itype && 2 != itype)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	int64_t curVal = 0;
	int64_t maxVal = 0;
	if (1 == itype)
	{
		curVal = pCreatrue->GetAttr(C_HP);
		maxVal = pCreatrue->GetAttr(C_MAX_HP);
		if (curVal >= maxVal)
		{
			return RET_PACKAGE_HP_FULL;
		}
	}
	else
	{
		curVal = pCreatrue->GetAttr(C_MP);
		maxVal = pCreatrue->GetAttr(C_MAX_MP);
		if (curVal >= maxVal)
		{
			return RET_PACKAGE_MP_FULL;
		}
	}
	bool addbagFlag = false;
	int64_t needVal = maxVal - curVal;
	int32_t addVal = 0;
	int32_t skillId = pVecParam->at(2);
	int32_t rate = pVecParam->at(3);
	if (skillId <= 0 && rate <= 0)
	{
		//skillid 和 rate 都为0 的时候是普通的血包
		
	}
	else
	{
		if (rate <= 0 || skillId <= 0)
		{
			return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
		}
		int64_t rateVal = maxVal * rate / 10000.0;
		//剩余血包可回复的数值 < 百分比数值，不走buff,直接回复
		if ((int64_t)leftHpMpVal >= rateVal)
		{
			SkillPart *pSkillPart = dynamic_cast<SkillPart*>(pCreatrue->GetPart(PART_SKILL));
			if (nullptr == pSkillPart)
			{
				return RET_FAIL;
			}
			if (!pSkillPart->AddStateBag(skillId, 1, pCreatrue))
			{
				return RET_PACKAGE_ITEM_CAN_NOT_USE;
			}
			addbagFlag = true;
		}
		needVal = rateVal;
	}

	if (needVal >= (int64_t)leftHpMpVal)
	{
		addVal = leftHpMpVal;
	}
	else
	{
		addVal = (int32_t)needVal;
	}
	leftHpMpVal -= addVal;
	item->SetHpMpValue(leftHpMpVal);//设置剩余可用HP,MP值

	if (!addbagFlag)
	{
		//玩家增加HP,MP
		if (1 == itype)
		{
			pCreatrue->AddAttr(C_HP, addVal, true);
		}
		else
		{
			pCreatrue->AddAttr(C_MP, addVal, true);
		}
	}

	return RET_SUCCESS;
}



int32_t CItemUse_HorseCard::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	//functionType=26 关联激活的坐骑id,有效时间（填写小时，永久填写-1）
	if (pVecParam->size() < 2)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	int32_t horseId = pVecParam->at(0);
	int32_t validHour = pVecParam->at(1);
	//坐骑部件
	HorsePart *pHorsePart = dynamic_cast<HorsePart*>(pCreatrue->GetPart(PART_HORSE));
	if (nullptr == pHorsePart)
	{
		return RET_FAIL;
	}

	//TODO:这里调用坐骑接口 
	return pHorsePart->ActiveHorse(horseId, validHour);
}




int32_t CItemUse_HangCard::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	//functionType=30 有效时间（填写小时，永久填写-1）
	if (pVecParam->size() < 1)
	{
		return RET_PACKAGE_ITEM_FUNC_PARAM_ERR;
	}
	int32_t validHour = pVecParam->at(0);
	//
	Player *pPlayer = dynamic_cast<Player*>(pCreatrue);
	if (nullptr == pPlayer)
	{
		return RET_FAIL;
	}
	//TODO:这里调用内挂接口 
	pPlayer->ActiveLeiGuaItem(validHour);

	return RET_SUCCESS;
}


int32_t CItemUse_ExpandStorage::onUse(const ItemItemCfgInfo *pItemCfg, CItemBase *item, int32_t nNum, const VEC_INT32 *pVecParam, Creature *pCreatrue, const VEC_INT32 *pVecOtherParam, UseItemArgProto &arg, Creature *pTarget)
{
	_UNUSE(pItemCfg);
	_UNUSE(item);
	_UNUSE(nNum);
	_UNUSE(pVecParam);
	_UNUSE(pVecOtherParam);
	_UNUSE(arg);
	_UNUSE(pTarget);
	Part *pPart = pCreatrue->GetPart(PART_PACKAGE);
	if (nullptr == pPart)
	{
		return RET_FAIL;
	}
	return pPart->ExpandStorage((uint16_t)nNum);
}